import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    result:
      {
      status: window.localStorage.getItem('result' || '[]') == null ? '' :JSON.parse(window.localStorage.getItem('result' || '[]')).status,
        info: window.localStorage.getItem('result' || '[]') == null ? '' :JSON.parse(window.localStorage.getItem('result' || '[]')).info,
    }
  },
  mutations: {
    login (state, result) {
      state.result = result
      window.localStorage.setItem('result', JSON.stringify(result))
    },
    logout(state){
      state.result= []
      window.localStorage.removeItem('result')
    }
  }
})
